package com.deep.search.controller.web;

import com.deep.search.annotation.ApiController;
import com.deep.search.model.params.SearchParam;
import com.deep.search.model.vo.SearchResultVO;
import com.deep.search.service.MallSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * 搜索页
 *
 * @author Deep
 * @date 2022/1/28
 */
@ApiController
public class ListController {

    @Autowired
    private MallSearchService mallSearchService;

    @GetMapping({"/", "/search", "search.html"})
    public String listPage(SearchParam searchParam, Model model) {
        SearchResultVO result = mallSearchService.search(searchParam);
        model.addAttribute("result", result);
        return "search";
    }

}
